<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        /* 
            1. 浮动的元素在文档流不占位置
            2. 浮动的元素碰到障碍物就停止浮动
            3. 对行元素设置浮动就相当于对行元素设置 display：inline-block
        */
        .d1 {
            width: 100px;
            height: 100px;
            border: solid;
            float: right;
        }
        .box{
            width: 400px;
            height: 400px;
            border: solid;
            margin: 30px auto;
        }
        .son{
            width: 100px;
            height: 100px;
            border: solid 1px red;
            /* float: left; */
        }
        span {
            width: 100px;
            height: 100px;
            border: solid;
        }
        span:nth-of-type(1) {
            float: left;
        }
        span:nth-of-type(2) {
            float: right;
        }
    </style>
</head>
<body>
    <div class="d1">1</div>
    <p>hello</p>
    <div class="box">
        <div class="son"></div>
        <p>hello</p>
    </div>
    <span>span1</span>
    <span>span2</span>
</body>
</html>